function supports_input_type(str){
 	var i=document.createElement("input");
	i.setAttribute("type",str);
	return i.type !="text";
	///such as: color\email\number\range\search\tel\url\date\time\datetime\datetime-local\month\week
}
function result_input_types_test(){
	var result="";
	result+="Input type: "+"<br/>";
	result+="input type=search: "+ (input_type("search")?" yes":" no")+"<br/>";
	result+="input type=tel: "+ (input_type("tel")?" yes":" no")+"<br/>";
	result+="input type=url: "+ (input_type("url")?" yes":" no")+"<br/>";
	result+="input type=email: "+ (input_type("email")?" yes":" no")+"<br/>";
	result+="input type=datetime: "+ (input_type("datetime")?" yes":" no")+"<br/>";
	result+="input type=date: "+ (input_type("date")?" yes":" no")+"<br/>";
	result+="input type=month: "+ (input_type("month")?" yes":" no")+"<br/>";
	result+="input type=week: "+ (input_type("week")?" yes":" no")+"<br/>";
	result+="input type=time: "+ (input_type("time")?" yes":" no")+"<br/>";
	result+="input type=datetime-local: "+ (input_type("datetime-local")?" yes":" no")+"<br/>";
	result+="input type=number: "+ (input_type("number")?" yes":" no")+"<br/>";
	result+="input type=range: "+ (input_type("range")?" yes":" no")+"<br/>";
	result+="input type=color: "+ (input_type("color")?" yes":" no")+"<br/>";
	result+="input type=checkbox: "+ (input_type("checkbox")?" yes":" no")+"<br/>";
	result+="input type=image: "+ (input_type("image")?" yes":" no")+"<br/>";	
	return result;
}
function result_textarea_test(){
	var result="";
	var i=document.createElement('textarea');
	result+="textarea:"+"<br/>";
	result+="maxlength attribute:"+(('maxLength' in i)?" yes":" no")+"<br/>";
	result+="wrap attribute:"+(('wrap' in i)?" yes":" no")+"<br/>";
	return result;
}
function result_select_test(){
	var result="";
	var i=document.createElement('select');
	result+="select:"+"<br/>";
	result+="required attribute:"+(('required' in i)?" yes":" no")+"<br/>";
	return result;
}
function result_fieldset_test(){
	var result="";
	var i=document.createElement('fieldset');
	result+="fieldset:"+"<br/>";
	result+="elements attribute:"+(('elements' in i)?" yes":" no")+"<br/>";
	result+="disabled attribute:"+(('disabled' in i)?" yes":" no")+"<br/>";
	return result;
}
function result_datalist_test(){
	var result="";
	var i=document.createElement('input');
	result+="datalist:"+"<br/>";
	result+="list attribute in field:"+(('list' in i)?" yes":" no")+"<br/>";
	return result;
}
function result_keygen_test(){
 	var result="";
	var i=document.createElement('keygen');
	result+="keygen:"+"<br/>";
	result+="challenge attribute:"+(('challenge' in i)?" yes":" no")+"<br/>";
	result+="keytype attribute:"+(('keytype' in i)?" yes":" no")+"<br/>";
	return result;
}
function result_output_test(){
	var result="";
	var i=document.createElement('output');
	result+="output:"+"<br/>";
	result+="form attribute:"+(('form' in i)?" yes":" no")+"<br/>";
	return result;
}
function result_progress_test(){
	var result="";
	var i=document.createElement('progress');
	result+="progress:"+"<br/>";
	result+="value attribute:"+(('value' in i)?" yes":" no")+"<br/>";
	return result;
}
function result_meter_test(){
	var result="";
	var i=document.createElement('meter');
	result+="meter:"+"<br/>";
	result+="value attribute:"+(('value' in i)?" yes":" no")+"<br/>";
	return result;
}
function result_field_vilidation_test(){
	var result="";
	var i=document.createElement('input');
	result+="field vilidation:"+"<br/>";
	result+="pattern attribute:"+(('pattern' in i)?" yes":" no")+"<br/>";
	result+="required attribute:"+(('required' in i)?" yes":" no")+"<br/>";
	return result;
}
function result_assocaition_test(){
	var result="";
	var i=document.createElement('label');
	result+="Association of controls and forms:"+"<br/>";
	result+="control property on labels:"+(('control' in i)?" yes":" no")+"<br/>";
	///////IE实现了form的部分功能，所以不能简单判断是否有form属性
		var element = document.createElement('div');
		document.body.appendChild(element);
		element.innerHTML = '<form id="fom"></form><input form="fom">';		
 		var tmp=element.lastChild.form == element.firstChild;
 		document.body.removeChild(element);
 	result+="form property on fields:"+(tmp?" yes":" no")+"<br/>";
 	i=document.createElement('input');
	result+="formAction property on fields:"+(('formAction' in i)?" yes":" no")+"<br/>";
	result+="formEnctype property on fields:"+(('formEnctype' in i)?" yes":" no")+"<br/>";
	result+="formMethod property on fields:"+(('formMethod' in i)?" yes":" no")+"<br/>";
	result+="formNoValidate property on fields:"+(('formNoValidate' in i)?" yes":" no")+"<br/>";
	result+="formTarget property on fields:"+(('formTarget' in i)?" yes":" no")+"<br/>";
	result+="labels property on fields:"+(('labels' in i)?" yes":" no")+"<br/>";
	return result;
}
function result_other_attributes_test(){
	var result="";
	var i=document.createElement('input');
	result+="Other attributes:"+"<br/>";
	result+="autofocus attribute:"+(('autofocus' in i)?" yes":" no")+"<br/>";
	result+="autocomplete attribute:"+(('autocomplete' in i)?" yes":" no")+"<br/>";
	result+="placeholder attribute:"+(('placeholder' in i)?" yes":" no")+"<br/>";
	result+="multiple attribute:"+(('multiple' in i)?" yes":" no")+"<br/>";
	result+="dirname attribute:"+(('dirname' in i)?" yes":" no")+"<br/>";
	return result;
}
function result_event_test(){
	var result="";
	var i=document.createElement('form');
	result+="Events:"+"<br/>";
	i.setAttribute("oninput", ' ');
	result+="oninput event:"+((typeof i.oninput =="function")?" yes":" no")+"<br/>";
	i.setAttribute("onchange", ' ');
	result+="onchange:"+((typeof i.onchange =="function")?" yes":" no")+"<br/>";
	i.setAttribute("oninvalid", ' ');
	result+="oninvalid event:"+((typeof i.oninvalid =="function")?" yes":" no")+"<br/>";
} 
function result_form_validation_test(){
	var result="";
	var i=document.createElement('form');
	result+="Form validation:"+"<br/>";
	result+="checkValidity method:"+((typeof i.checkValidity=="function")?" yes":" no")+"<br/>";
	result+="noValidate attribute:"+(('noValidate' in i)?" yes":" no")+"<br/>";
	return result;
}
function start_form_test(container) {
	console.log(container);
	htmlContent = "Field types: " + "<br/>";
	htmlContent+= result_input_types_test();
	htmlContent+= result_textarea_test();
	htmlContent+= result_select_test();
	htmlContent+= result_fieldset_test();
	htmlContent+= result_datalist_test();
	htmlContent+= result_keygen_test();
	htmlContent+= result_output_test();
	htmlContent+= result_progress_test();
	htmlContent+= result_meter_test();
	htmlContent+="Fields: " +"<br/>";
	htmlContent+= result_field_vilidation_test();
	htmlContent+= result_assocaition_test();
	htmlContent+= result_other_attributes_test();
	htmlContent+= result_event_test();
	htmlContent+="Forms: " +"<br/>";
	htmlContent+= result_form_validation_test();
	container.html(htmlContent);
} 
